// 引入 react 依赖
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text, View, Image, TouchableOpacity, ImageBackground, ScrollView, TextInput, InteractionManager } from 'react-native';

// 引入第三方依赖
import _ from 'lodash';
import pureRender from 'pure-render-decorator';
import { Actions } from 'react-native-router-flux';
import ScrollableTabView from 'react-native-scrollable-tab-view';

// antd 按需加载
import { InputItem, Tabs, Toast, Portal, List, Picker } from '@ant-design/react-native';

// 引入 处理数据 所需文件
import { deliveryAddressInsert, deliveryAddressDefault, deliveryAddressList, region } from '../../module/module.js'

// 引入样式
import Style from './style/style.js';

// 引入公用组件
import { Status, NavBar, ScrollableTabBar, Radio, AddressForm } from '../../components/index.js'

// 引入专用组件
import { } from './components'

// 引入工具包
import { press, size, ScreenWidth, borderBottom, hotTextColor, validation, defaultDataList, onEndReached, onRefresh, concatDataList, defaultPage } from '../../util/utils.js'

class CreatAddress extends Component {

  constructor(props) {
    super(props)
    this.state = {

    }
  }


  componentDidMount() {
  }

  // 新增收货地址 /delivery/address/insert
  deliveryAddressInsert(option) {
    deliveryAddressInsert(option).then(res => {
      Toast.success(res.message, 1, () => {
        deliveryAddressDefault()
        deliveryAddressList()
        Actions.pop()
      })
    })
  }


  render() {
    const { province, city, area, town, provinceId, cityId, areaId, townId, provinceName, cityName, areaName, townName, isDefault } = this.state
    return (
      <View style={Style.container}>
        <Status />
        <NavBar
          title="新增收货地址"
          back={true}
        />
        <AddressForm onPress={(option) => this.deliveryAddressInsert(option)}>新增收货地址</AddressForm>
      </View >
    );
  }
}

// <ScrollableTabView
//         // initialPage={index}
//         // tabBarPosition="overlayTop"
//         renderTabBar={() => <ScrollableTabBar activeTextColor="#000000" inactiveTextColor="#000" style={{ borderBottomColor: 'transparent' }} />}
//         tabBarBackgroundColor="#fff"
//         tabBarTextStyle={{
//           fontSize: 14,
//         }}
//         tabBarUnderlineStyle={{
//           backgroundColor: '#000000',
//           height: 2
//         }}
//         style={{
//           backgroundColor: '#fff',
//           borderColor: 'transparent',
//           height: 800,
//           width: ScreenWidth
//         }}
//       >
//         {catyValue.map((item, index) => (
//           <View style={{}} key={index} tabLabel={selectValue[index].name || '请选择'}>

//           </View>
//         ))}
//       </ScrollableTabView>


export default connect(({ user }) => ({
  user,
}))(pureRender(CreatAddress))
